<?php
/**
 * 添加管理员组页面
 * User: lvshuyun
 * Date: 2015/6/9
 * Time: 10:28
 */

use yii\helpers\Url;
use common\widgets\ActiveForm;

$this->title = '角色管理';


$form = ActiveForm::begin();
echo $form->field($adminRole, 'roleName')->textInput();
echo $form->field($adminRole, 'agentID')->textInput();

?>

<div class="form-group">
    <label class="control-label col-sm-3" for="adminrole-power">权限</label>
    <div class="col-sm-6">
        <?php
        foreach($allPowers as $module){
            ?>
            <dl>
                <dt><h4><b><?php echo $module['title'];?></b></h4></dt>
                <dd>
                <?php
                foreach($module['child'] as $k => $power){
                    $chk = "<input name='power[]' type='checkbox' value='".$power[0].'/'.$power[1]."'/>".$power[2];
                    if($k>0 && $power[0] != $module['child'][$k-1][0]){
                        echo "</dd><dd>" . $chk;
                    }else{
                        if($k>0) echo "&nbsp;&nbsp;";
                        echo $chk;
                    }
                    if(isset($power[4]) && !empty($power[4])){
                        foreach($power[4] as $p){
                            $chk = "<input name='power[]' type='checkbox' value='".$power[0].'/'.$power[1]."'/>".$power[2];
                            if($k>0 && $power[0] != $module['child'][$k-1][0]){
                                echo "</dd><dd>" . $chk;
                            }else{
                                if($k>0) echo "&nbsp;&nbsp;";
                                echo $chk;
                            }
                        }
                    }
                }
                ?>
                </dd>
            </dl>
        <?php
        }
        ?>
    </div>

</div>
<?php
ActiveForm::end();



